package com.yzc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yzc.pojo.UserBean;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author Yzc
 * @description 针对表【t_user】的数据库操作Mapper
 * @createDate 2024-05-23 14:22:12
 * @Entity com.yzc.pojo.UserBean
 */
@Mapper
public interface UserBeanMapper extends BaseMapper<UserBean> {

    List<UserBean> loadaAll();

    List<UserBean> selectInfosByWhere(String name);

    @Delete("delete from t_user_kz where state=0 and userid=#{id}")
    void deleteRolesByUserId(Integer id);

    @Update("UPDATE t_user SET pass = #{newpass} WHERE id = #{id} ")
    void updatePass(UserBean userBean);

    @Update("UPDATE t_user SET name = #{name}, beizhu = #{beizhu} where id = #{id}")
    void updateXinxi(UserBean userBean);


    void saveUser(UserBean userBean);

    void saveUserKz(UserBean userBean);

    void updateInfo(UserBean userBean);

    @Update("UPDATE t_user SET state = 1 WHERE id = #{id} ")
    void deleteByState(UserBean userBean);

    @Update("UPDATE t_user_kz SET state = 1 WHERE userid = #{id} ")
    void deleteRolesByState(UserBean userBean);

}